import myAxios from "@/request";
import type {
  BalanceWarningQueryRequest,
  BalanceWarningAddRequest,
  BalanceWarningUpdateRequest,
} from "@/models/balanceWarning";

/**
 * 分页获取余额预警规则列表
 */
export function listBalanceWarningByPage(
  balanceWarningQueryRequest: BalanceWarningQueryRequest
) {
  return myAxios.request({
    url: "/api/balanceWarning/list/page",
    method: "post",
    data: balanceWarningQueryRequest,
  });
}

/**
 * 添加余额预警规则
 */
export function addBalanceWarning(
  balanceWarningAddRequest: BalanceWarningAddRequest
) {
  return myAxios.request({
    url: "/api/balanceWarning/add",
    method: "post",
    data: balanceWarningAddRequest,
  });
}

/**
 * 更新余额预警规则
 */
export function updateBalanceWarning(
  balanceWarningUpdateRequest: BalanceWarningUpdateRequest
) {
  return myAxios.request({
    url: "/api/balanceWarning/update",
    method: "post",
    data: balanceWarningUpdateRequest,
  });
}

/**
 * 删除余额预警规则
 */
export function deleteBalanceWarning(id: number) {
  return myAxios.request({
    url: "/api/balanceWarning/delete",
    method: "post",
    data: { id },
  });
}
